package datos;

import java.io.FileInputStream;
import java.io.Serializable;
import java.io.FileOutputStream;
import java.io.ObjectOutputStream;
import java.io.FilterInputStream;
import java.io.ObjectInputStream;
import negocios.Grafo;
import negocios.Minibook;
import negocios.Persona;

public class BackUp {

	public static void persistenciaGuardar(Minibook miniOut){
		try{
			FileOutputStream fos = new FileOutputStream("mini.txt");
			ObjectOutputStream out = new ObjectOutputStream(fos);
			out.writeObject(miniOut);
			out.close();
		}
		catch(Exception ex){
			ex.printStackTrace();
		}
	}

	public static Minibook persistenciaRecuperar(){
		Minibook miniIN = null;
		try{
			FileInputStream fis = new FileInputStream("mini.txt");
			ObjectInputStream in = new ObjectInputStream(fis);			
			miniIN = (Minibook) in.readObject();	
			in.close();
		}
		catch (Exception ex){
			ex.printStackTrace();
		}
		return miniIN;
	}
}
